Fiatlight demo#

[00:00:00] Fiatlight, in other words, “Let there be Light” is a user-friendly framework that lets you transform your ideas into fully functional applications or functions graphs, in a matter of minutes.

[00:00:13] First example: a meme generator#

[00:00:13] As an example, the application you can see here , is a fully functional meme generator.

[00:00:18]

[00:00:19] Seamless State Saving and Recovery#

[00:00:19] With this application, the user can create an image via AI, add a meme text onto it, and save and reload , creations.

[00:00:27] A fully functional app in 4 lines of code#

[00:00:29] Its user interface code is four lines long: we simply import fiatlight, and compose two functions. First, a pure python function which invokes Stable Diffusion, based on a text prompt and a random seed, and then, another pure function which can add text onto an image with a customizable font.

[00:00:52] Automatic interface for functions#

[00:00:52] The user interface is generated by an advanced automatic analysis of the function, ensuring that all function parameters (like the prompt and seed) and each function output are assigned specific widgets, such as an image widget.

[00:01:07] Automatic interface for dataclasses and models#

[00:01:07] Fiatlight handles structured data, such as dataclasses and pydantic models, grouping related items and making it easier to save and share data. For example, a color member will be associated with a color selector. Many customization options are available, such as setting the range for numeric parameters, and you can here see an example with the available font size range.

[00:01:33] Automatic interface for data validation#

[00:01:33] Data validators are also supported, ensuring inputs are correct. For example, here, we make sure the prompt is sufficiently long. Validators provide immediate feedback while editing.

[00:01:46] Display function documentation#

[00:01:47] Finally, the function documentation can also be displayed in the application. This documentation can be formatted to be more readable, using a subset of Markdown.

[00:01:58] Second example: comparing sort algorithms#

[00:01:59] As a second example, here is an application that displays the real-time status of various algorithms which are currently sorting a list of numbers simultaneously. Fiatlight makes it possible to see the inner workings of those algorithms, right in front of your eyes. This can be written in 50 lines of simple, readable code. Refer to the related tutorial for more information.

[00:02:24] Tailored Kits for different areas of activity#

[00:02:24] Fiatlight provides tailored kits designed for various areas of activity. These include the Image Kit for advanced image analysis, the Matplotlib and ImPlot Kits for real-time plotting and data visualization, and the DataFrame Kit for handling large tabular data. ​

[00:02:42] The Image Kit#

[00:02:42] The image kit provides an advanced image analyser.

[00:02:46] As soon as a function uses or returns an Image type, which is a synonym for a numpy array, this viewer will be displayed.

[00:02:55] In this example, we load an image from the filesystem.

[00:02:59] Then, we connect three processing nodes to this image source.

[00:03:03] The first node applies the Canny algorithm to detect contours.

[00:03:08] The second node performs an analysis of the image variations , via a Sobel operator.

[00:03:14] The third node applies a color transformation to the image.

[00:03:18] The viewer allows for synchronized zooming and panning across all images, making detailed inspection seamless.

[00:03:26] As you zoom in, the pixel values are displayed directly on the image.

[00:03:31] You can also apply various colormaps to enhance visibility.

[00:03:35] Additionally, the viewer can save the displayed image. ​

[00:03:39] Charting Kits#

[00:03:40] Specific kits for Matplotlib and ImPlot enable to display advanced plots in real time.

[00:03:46] Any function which returns a Matplotlib figure will be displayed in the user interface. The whole range of Matplotlib plots is thus available.In this example, the Interactive histogram, and the gaussian heatmap are displayed via Matplotlib.

[00:04:02] Any function which returns a numerical array of one or two dimensions, will be displayed in the user interface using ImPlot, a GPU accelerated library for ImGui.

[00:04:14] In this example, the Sine Wave is updated at 120 images per second, and the spirograph curve can easily be adjusted.

[00:04:24] Pandas DataFrame#

[00:04:25] The dataframe kit enables to display large quantities of tabular data in the user interface.

[00:04:31] Any function which returns a Pandas dataframe will be displayed as a table in the GUI. By opening a popup, columns can be ordered.

[00:04:41] Dataframes can easily be filtered with a few lines of expressive code.

[00:04:47] Additionally, the two nodes “survival rate” and “age histogram” show how easily, ImPlot can be connected to a dataframe, and display analytics, in this case showing that the sex and class of the passengers had a significant impact on their survival rate.

[00:05:04] The Audio Kit (experimental)#

[00:05:06] ​ The experimental audio kit enables to record, play and display sound waves in the user interface.

[00:05:13] Any function which returns sound data, will be displayed as a playable sound wave.

[00:05:19] In this second example, the Microphone sound will be analyzed in three different ways. Let me sing for a second:

[00:05:29] And you can now see two graphs and an estimation of the note I just sang.

[00:05:34] Interactively test new libraries#

[00:05:34] Fiatlight can make it extremely easy to interactively test new libraries, even if you are not familiar with them beforehand. The fundamental frequency estimation graph you see here, is created using “lib rosa”, a well-known audio processing library. The code for this graph is almost a direct copy from the “lib rosa” documentation, but it became almost “alive” inside Fiatlight. ​

[00:06:00] Fine tune your algorithm steps#

[00:06:00] Fiatlight allows you to thoroughly inspect the different steps in your algorithms, which is crucial for ensuring their quality.

[00:06:08] In this example, we display a solution to a classic problem: finding the most common words in a text,here on the “Hamlet” play, by Shakespeare.

[00:06:18] The solution consists of composing several functions.Let’s see it in action:

[00:06:24] We open the file, then transform it to lower case, split the words,

[00:06:30] optionally filter out the shorter words, sort them alphabetically,

[00:06:35] group and count the identical words - as an example, the word “about” appears 19 times in the play -, and finally display the most common words.​

[00:06:45] Fine tune functions “Internal Workings”#

[00:06:45] Fiatlight offers powerful ways to diagnose and fine-tune the internal workings of your functions.

[00:06:53] The sorting competition example which we saw previously, is a good example of how the internal processing of a function can be displayed, even if the function is running asynchronously.

[00:07:05] In this second example, the “add toon edge” function, whose intent is to draw colored contours on an image, needs to perform an edge detection. By opening the Fiat tuning section, we can have a look at all the intermediate states of our function. In this example, we have the duration of all the steps, and their outputs, which, as you can see, are extremely dependent on the parameters.

[00:07:30] Adding fine-tuning capabilities to your functions is as simple as filling a list with the elements you want to display in the ‘Fiat Tuning’ section!

[00:07:39] A wide range of GUI elements#

[00:07:43] ​​Because Fiatlight is based on Dear ImGui, a versatile GUI library, it offers a wide range of customizable widgets. You can see here a small extract, together with the corresponding python code to the right.

[00:07:57] Furthermore, with the addition of Dear ImGui Bundle, many additional libraries are available, and can be used to create advanced applications.